<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for javascripts/SqlLab/components/SouthPane.jsx</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../../../prettify.css" />
    <link rel="stylesheet" href="../../../base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(../../../sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="../../../index.html">All files</a> / <a href="index.html">javascripts/SqlLab/components</a> SouthPane.jsx
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">34.29% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>12/35</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>0/6</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>0/4</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">35.29% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>12/34</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import { Alert, Tab, Tabs } from 'react-bootstrap';
import QueryHistory from './QueryHistory';
import ResultSet from './ResultSet';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as Actions from '../actions';
import React from 'react';
&nbsp;
import shortid from 'shortid';
&nbsp;
/*
    editorQueries are queries executed by users passed from SqlEditor component
    dataPrebiewQueries are all queries executed for preview of table data (from SqlEditorLeft)
*/
const propTypes = {
  editorQueries: React.PropTypes.array.isRequired,
  dataPreviewQueries: React.PropTypes.array.isRequired,
  actions: React.PropTypes.object.isRequired,
  activeSouthPaneTab: React.PropTypes.string,
};
&nbsp;
const defaultProps = {
  activeSouthPaneTab: 'Results',
};
&nbsp;
class SouthPane extends React.PureComponent {
<span class="fstat-no" title="function not covered" >  constructor(</span>props) <span class="cstat-no" title="statement not covered" >{</span>
    super(props);
<span class="cstat-no" title="statement not covered" >    this.state = {</span>
      innerTabHeight: this.getInnerTabHeight(),
    };
  }
  getInnerTabHeight() {
    // hack to get height the tab container so it can be fixed and scroll in place
    // calculate inner tab height
&nbsp;
    // document.getElementById('brace-editor').getBoundingClientRect().height;
    c</span>onst sqlEditorHeight = <span class="cstat-no" title="statement not covered" >192;
&nbsp;
    // document.getElementById('js-sql-toolbar').getBoundingClientRect().height;
    c</span>onst sqlToolbar = <span class="cstat-no" title="statement not covered" >30;
&nbsp;
    // document.getElementsByClassName('nav-tabs')[0].getBoundingClientRect().height * 2;
    c</span>onst tabsHeight = <span class="cstat-no" title="statement not covered" >88;
&nbsp;
    // document.getElementsByTagName('header')[0].getBoundingClientRect().height;
    c</span>onst headerHeight = <span class="cstat-no" title="statement not covered" >59;
&nbsp;
    const sum =
<span class="cstat-no" title="statement not covered" >      sqlEditorHeight +</span>
      sqlToolbar +
      tabsHeight +
      headerHeight;
&nbsp;
<span class="cstat-no" title="statement not covered" >    return window.innerHeight - sum - 95;</span>
  }
  switchTab(id) {
<span class="cstat-no" title="statement not covered" >    this.props.actions.setActiveSouthPaneTab(id);</span>
  }
  render() <span class="cstat-no" title="statement not covered" >{</span>
    l</span>et <span class="cstat-no" title="statement not covered" >latestQuery;
    c</span>onst props = <span class="cstat-no" title="statement not covered" >this.props;
<span class="cstat-no" title="statement not covered" >    if (props.editorQueries.length &gt; 0) {</span>
<span class="cstat-no" title="statement not covered" >      latestQuery = props.editorQueries[props.editorQueries.length - 1];</span>
    }
    l</span>et <span class="cstat-no" title="statement not covered" >results;
<span class="cstat-no" title="statement not covered" >    if (latestQuery) {</span>
<span class="cstat-no" title="statement not covered" >      results = (</span>
        &lt;ResultSet
          showControls
          search
          query={latestQuery}
          actions={props.actions}
          resultSetHeight={this.state.innerTabHeight}
        /&gt;
      );
    } else {
<span class="cstat-no" title="statement not covered" >      results = &lt;Alert bsStyle="info"&gt;Run a query to display results here&lt;/Alert&gt;;</span>
    }
&nbsp;
    c</span>onst dataPreviewTabs = <span class="cstat-no" title="statement not covered" >props.dataPreviewQueries.map(<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >(</span>query) =&gt; (</span>
      &lt;Tab
        title={`Preview for ${query.tableName}`}
        eventKey={query.id}
        key={query.id}
      &gt;
        &lt;ResultSet
          query={query}
          visualize={false}
          csv={false}
          actions={props.actions}
          cache
          resultSetHeight={this.state.innerTabHeight}
        /&gt;
      &lt;/Tab&gt;
    ));
&nbsp;
<span class="cstat-no" title="statement not covered" >    return (</span>
      &lt;div className="SouthPane"&gt;
        &lt;Tabs
          bsStyle="tabs"
          id={shortid.generate()}
          activeKey={this.props.activeSouthPaneTab}
          onSelect={this.switchTab.bind(this)}
        &gt;
          &lt;Tab
            title="Results"
            eventKey="Results"
          &gt;
            {results}
          &lt;/Tab&gt;
          &lt;Tab
            title="Query History"
            eventKey="History"
          &gt;
            &lt;div style={{ height: `${this.state.innerTabHeight}px`, overflow: 'scroll' }}&gt;
              &lt;QueryHistory queries={props.editorQueries} actions={props.actions} /&gt;
            &lt;/div&gt;
          &lt;/Tab&gt;
          {dataPreviewTabs}
        &lt;/Tabs&gt;
      &lt;/div&gt;
    );
  }
}
&nbsp;
f</span>unction <span class="fstat-no" title="function not covered" >mapStateToProps(state) {
<span class="cstat-no" title="statement not covered" >  return {</span>
    activeSouthPaneTab: state.activeSouthPaneTab,
  };
}
&nbsp;
f</span>unction <span class="fstat-no" title="function not covered" >mapDispatchToProps(dispatch) {
<span class="cstat-no" title="statement not covered" >  return {</span>
    actions: bindActionCreators(Actions, dispatch),
  };
}
&nbsp;
SouthPane.propTypes = propTypes;
SouthPane.defaultProps = defaultProps;
&nbsp;
export default connect(mapStateToProps, mapDispatchToProps)(SouthPane);
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Apr 11 2017 20:15:55 GMT-0700 (PDT)
</div>
</div>
<script src="../../../prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="../../../sorter.js"></script>
</body>
</html>
